<template>
  <div>
    <!-- vue-quill-editor -->
    <h3>{{ form.msg }}</h3>
    <el-form ref="form" :model="form" :rules="rules">
      <el-form-item prop="msg">
        <quillEditor v-model="form.msg" @change="changeEvent" />
      </el-form-item>
    </el-form>
    <el-button @click="submit">确定</el-button>

    <!-- v-model="" -->
    <!-- change:值改变时事件 -->
    <!-- blur:失去焦点事件 -->
  </div>
</template>
<script>
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

import { quillEditor } from 'vue-quill-editor'
export default {
  components: {
    quillEditor
  },
  data() {
    return {
      form: {
        msg: ''
      },
      rules: {
        msg: [{ required: true, message: '必填', trigger: 'change' }]
      }
    }
  },
  methods: {
    submit() {
      this.$refs.form.validate()
    },
    changeEvent() {
      this.$refs.form.validateField(['msg'])
    }
  }
}
</script>
<style>
</style>
